package com.jjh.exception;

import com.jjh.consts.ResEnum;
import lombok.Data;

/**
 * 总的异常类，包含必要的三个信息,可以使子类继承变量，
 * 这样子类就不用重复写这些东西了
 */
@Data
public class MyException extends RuntimeException{

    protected Integer code;

    protected String msg;

    protected Object data;


    public MyException(ResEnum resEnum, Object data){
        this.code = resEnum.getCode();
        this.msg = resEnum.getMsg();
        this.data = data;
    }

    @Override
    public String getMessage() {
        return this.msg;
    }
}
